package com.example.demo.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;


@Configuration
public class WebConfig extends WebMvcConfigurationSupport {
    @Override
    protected void addResourceHandlers(ResourceHandlerRegistry registry) {
        //registry.addResourceHandler("/img/**") :将访问地址（）进行映射
        //.addResourceLocations("file:D:/img/") :映射成服务器地址
        registry.addResourceHandler("/img/**").addResourceLocations("file:///Users/lin/Desktop/upload/");
    }

}
